package wodegua.d3_speedkey;

import java.util.Random;
import java.util.Scanner;

public class SpeedKey {
    public static void main(String[] args) {
        int[] a = {1,2,3,4,5};
        for (int i = 0, j = a.length - 1; i < j; i++, j--) {
            int b = a[j];
            a[j] = a[i];
            a[i] = b;
        }
        for (int i = 0; i < a.length; i++) {
            System.out.println(a[i]);
        }
//        int a1 = 0B100;
//        System.out.println(a1);
//
//        int a2 = 0101;
//        System.out.println(a2);
//
//        int a3 = 0x100;
//        System.out.println(a3);
//
//        Random random = new Random();
//        System.out.println("随机数："+random.nextInt());
//
//        Scanner scanner = new Scanner(System.in);
//        System.out.println("请输入您的年龄：");
//        int age = scanner.nextInt();
//        System.out.println("您的年龄是：" + age);
//
//        System.out.println("请输入您的姓名：");
//        String name = scanner.next();
//        System.out.println("您的姓名是：" + name);
        Random random = new Random();
        int number = random.nextInt(100);
        System.out.println("随机数字：" + number);

        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.println("请输入您猜的0-100数字：");
            int inNUmber = scanner.nextInt();
            if (inNUmber == number) {
                System.out.println("恭喜您猜对了");
                break;
            } else if (inNUmber > number) {
                System.out.println("猜的数字过大");
            } else {
                System.out.println("猜的数字过小");
            }
        }
    }
}
